import request from '@/config/axios'

// 用药记录 VO
export interface MedicationRecordVO {
  recordId: number // 记录ID
  planId: number // 计划ID
  scheduledTime: Date // 计划服药时间
  actualTime: Date // 实际服药时间
  status: string // 状态
  delayMinutes: number // 延迟分钟数(0表示准时)
  confirmMethod: string // 确认方式
  photoUrl: string // 服药凭证照片
  note: string // 备注
}

// 用药记录 API
export const MedicationRecordApi = {
  // 查询用药记录分页
  getMedicationRecordPage: async (params: any) => {
    return await request.get({ url: `/remind/medication-record/page`, params })
  },

  // 查询用药记录详情
  getMedicationRecord: async (id: number) => {
    return await request.get({ url: `/remind/medication-record/get?id=` + id })
  },

  // 新增用药记录
  createMedicationRecord: async (data: MedicationRecordVO) => {
    return await request.post({ url: `/remind/medication-record/create`, data })
  },

  // 修改用药记录
  updateMedicationRecord: async (data: MedicationRecordVO) => {
    return await request.put({ url: `/remind/medication-record/update`, data })
  },

  // 删除用药记录
  deleteMedicationRecord: async (id: number) => {
    return await request.delete({ url: `/remind/medication-record/delete?id=` + id })
  },

  // 导出用药记录 Excel
  exportMedicationRecord: async (params) => {
    return await request.download({ url: `/remind/medication-record/export-excel`, params })
  },
}